package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.LogMapper;
import com.itheima.pojo.Clazz;
import com.itheima.pojo.OperateLog;
import com.itheima.pojo.PageResult;
import com.itheima.pojo.Pagination;
import com.itheima.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;


    @Override
    public PageResult<OperateLog> pageList(Pagination pagination) {

        PageHelper.startPage(pagination.getPage(), pagination.getPageSize());

        List<OperateLog> list = logMapper.pageList(pagination);//调用Mapper执行查询，获取当前页数据列表

        Page<OperateLog> page = (Page<OperateLog>) list;

        return new PageResult<OperateLog>(page.getTotal(), page.getResult());

    }
}
